<template>
  <div class="login">
    <el-form :inline="true" ref="loginForm" :model="loginForm" class="login-form">
      <el-tabs v-model="activeName">
        <el-tab-pane label="下单" name="first"><el-form-item label="付款账号">
            <el-input v-model="loginForm.acct_no" type="text" auto-complete="off">
            </el-input>
          </el-form-item>
          <el-form-item label="付款账户">
            <el-input v-model="loginForm.acct_name" type="text" auto-complete="off">
            </el-input>
          </el-form-item>
          <el-form-item label="交易流水">
            <el-input v-model="loginForm.tran_seq_no" type="text" auto-complete="off">
            </el-input>
          </el-form-item>
          <el-form-item label="跨行标识">
            <el-select v-model="loginForm.to_bank_type" placeholder="请选择">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>



          <el-form-item label="收方账号">
            <el-input v-model="loginForm.to_acct_no" type="text" auto-complete="off">
            </el-input>
          </el-form-item>

          <el-form-item label="收方户名">
            <el-input v-model="loginForm.to_acct_name" type="text" auto-complete="off">
            </el-input>
          </el-form-item>

          <el-form-item label="收方类型">
            <el-select v-model="loginForm.to_acct_type" placeholder="请选择">
              <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="交易金额">
            <el-input v-model="loginForm.tran_amt" type="text" auto-complete="off">
            </el-input>
          </el-form-item>



          <el-form-item style="width:100%;">
            <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
              @click.native.prevent="handleLogin">
              <span>下 单</span>
            </el-button>
          </el-form-item>
        </el-tab-pane>
        <el-tab-pane label="查询" name="second"> <el-form-item label="订单号">
            <el-input v-model="loginForm.tran_seq_no" type="text" auto-complete="off">
            </el-input>
          </el-form-item>
          <el-form-item style="width:100%;">
            <el-button :loading="loading" size="medium" type="primary" style="width:100%;"
              @click.native.prevent="handlequery">
              <span>查 询</span>
            </el-button>
          </el-form-item>
        </el-tab-pane>

      </el-tabs>

    </el-form>



  </div>
</template>
<script>
import { getCodeImg, pay, query } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'

export default {
  name: "Login",
  data() {
    return {
      codeUrl: "",
      loginForm: {
        acct_no: "117010100100733989",
        acct_name: "直连测试",
        tran_seq_no: "123321222",
        to_bank_type: "01",
        to_acct_no: "01234234232",
        to_acct_name: "上海测三",
        to_acct_type: "01",
        tran_amt: "101",
      },
      options: [{
        value: '01',
        label: '本地本行'
      }, {
        value: '02',
        label: '异地本行'
      }, {
        value: '03',
        label: '本地他行'
      }, {
        value: '04',
        label: '异地他行'
      }, {
        value: '05',
        label: '国外他行'
      }, {
        value: '06',
        label: '国外本行'
      }],

      options2: [{
        value: '01',
        label: '对私'
      }, {
        value: '02',
        label: '对公'
      }, {
        value: '03',
        label: '银行内部户'
      }],

      activeName: "first",
      loading: false,

      // 验证码开关
      captchaEnabled: true,
      // 注册开关
      register: false,
      redirect: undefined
    };
  },
  watch: {
    $route: {
      handler: function (route) {
        this.redirect = route.query && route.query.redirect;
      },
      immediate: true
    }
  },
  created() {
  },
  methods: {

    handleLogin() {
      pay(this.loginForm).then(res => {
        alert(res.msg)


      });
    },

    handlequery() {
      query(this.loginForm).then(res => {
        alert(res.msg)


      });
    }
  }
};
</script>

<style rel="stylesheet/scss" lang="scss">
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  background-image: url("../assets/images/login-background.jpg");
  background-size: cover;
}

.title {
  margin: 0px auto 30px auto;
  text-align: center;
  color: #707070;
}

.login-form {
  border-radius: 6px;
  background: #ffffff;
  width: 400px;
  padding: 25px 25px 5px 25px;

  .el-input {
    height: 38px;

    input {
      height: 38px;
    }
  }

  .input-icon {
    height: 39px;
    width: 14px;
    margin-left: 2px;
  }
}

.login-tip {
  font-size: 13px;
  text-align: center;
  color: #bfbfbf;
}

.login-code {
  width: 33%;
  height: 38px;
  float: right;

  img {
    cursor: pointer;
    vertical-align: middle;
  }
}

.el-login-footer {
  height: 40px;
  line-height: 40px;
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
  color: #fff;
  font-family: Arial;
  font-size: 12px;
  letter-spacing: 1px;
}

.login-code-img {
  height: 38px;
}
</style>
